Cloning source listers

back to section start!
 
  Here's a script written by Gary Gagnon way back in 1995, (I can't even 
remember back that far).  It clones any listers that are currently in state 
SOURCE. 
  So if you have a Source lister with path 'RAM:' and one with path 'HD0:', 
after running this script you'll end up with two listers open for each of 
those paths. 
 
/* 
 $VER:       CloneSRCE.dopus5 1.0 Jun-01-95 
 Written by: Gary Gagnon (garyg@wimsey.com) 
 Purpose:    ARexx script to clone SRCE lister(s) 
 Syntax:     From function editor "ARexx DOpus5:ARexx/Same.dopus5 {Qp}" 
 Note:       I keep my DOpus5 ARexx scripts in DOpus5:ARexx 
 Note:       If no listers flagged as SRCE, nothing is opened 
*/ 
 
options results 
parse arg portname 
address value portname 
 
'lister query source' 
srclist = result 
 
if result = 'RESULT' then 
  exit 0 
 
do forever 
  if srclist = '' then leave 
 
  /* the following command line does a little ARexx magic */ 
  /* try this with any other language - it won't be as simple! */ 
 
  parse var srclist curlist srclist 
 
  /* 
    if you couldn't figure it out,  it extracts the first value from 
    the string and moves the remaining values (if any) back to the 
    same string.  This is what allows this to duplicate all SRCE 
    listers within this simple loop (and also makes sure it won't be 
    an endless loop). Languages without type checks can be nice! 
  */ 
 
  'lister new' 
  newlist = result 
  'lister copy' curlist newlist 
end 
 
 
 
  Let's modify it a bit :) 
 
 
/* 
 $VER: Clone.dopus5 1.0 (23.9.98) 
 
 Original by: Gary Gagnon (garyg@wimsey.com) 
 Purpose:    ARexx script to clone SRCE/DEST lister(s) 
 Syntax:     From function editor "ARexx DOpus5:ARexx/Same.dopus5 {Qp}  
*/ 
 
options results 
parse arg portname state . 
address value portname 
if state = '' then exit 
if pos(upper(state),'SOURCE DEST') = 0 then exit 
 
'lister query 'state 
srclist = result 
 
if result = 'RESULT' then 
  exit 0 
 
do forever 
  if srclist = '' then leave 
 
  /* the following command line does a little ARexx magic */ 
  /* try this with any other language - it won't be as simple! */ 
 
  parse var srclist curlist srclist 
 
  /* 
    if you couldn't figure it out,  it extracts the first value from 
    the string and moves the remaining values (if any) back to the 
    same string.  This is what allows this to duplicate all SRCE 
    listers within this simple loop (and also makes sure it won't be 
    an endless loop). Languages without type checks can be nice! 
  */ 
 
  'lister new' 
  newlist = result 
  'lister copy' curlist newlist 
end 
 
 
  Now it will clone Source or Destination listers depending on whether you 
call it with the SOURCE or DEST parameter. 
 

DOpus PLUS - giving you that bit extra...